package com.wgl.express.UI;

import com.wgl.express.entity.Package;
import com.wgl.express.entity.Station;
import com.wgl.express.entity.User;
import com.wgl.express.service.Impl.PackageServiceImpl;
import com.wgl.express.service.Impl.StationServiceImpl;
import com.wgl.express.service.Impl.UserServiceImpl;
import com.wgl.express.service.PackageService;
import com.wgl.express.service.StationService;
import com.wgl.express.service.UserService;
import com.wgl.express.util.Util;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

import static com.wgl.express.text.Text.LINE;

public class tes {
    public static void main(String[] args) {
        StationService stationService = new StationServiceImpl();
        List<Station> stations = stationService.selectAll();
        Util util = Util.getUtil();
        int sid;
        util.say("请输入站点编号：");
        sid = util.readInt();
        List<Station> collect = stations.stream().filter((s) -> s.getSid() == sid).collect(Collectors.toList());
        if (collect.size() == 1){
            util.say(LINE);
            Station s = collect.get(0);
            String name,address,capacity;
            util.readLine();
            util.say("请输入站点名称：");
            if (!(name = util.readLine()).equals("")) s.setStationname(name);
            util.say("请输入站点地址：");
            if (!(address = util.readLine()).equals("")) s.setStationaddress(address);
            util.say("请输入站点容量：");
            if (!(capacity = util.readLine()).equals("")) s.setCapacity(Integer.parseInt(capacity));
            System.out.println(s);
        }
    }
}
